home *** CD-ROM | disk | FTP | other *** search
/ Eagles Nest BBS 8 / Eagles_Nest_Mac_Collection_Disc_8.TOAST / Developer Environments / MacCjr / MacC Jr / Library Folder / C Include Folder / Quickdraw.h < prev    next >
Encoding:
Text File  |  1987-01-06  |  5.8 KB  |  300 lines  |  [TEXT/EDIT]

  1. // quickdraw.h
  2. // © Copyright 1984 Consulair Corp, All Rights Reserved.
  3. // Portions © Copyright Apple Computer, Inc: 1982, 1983, 1984
  4. //            Stanford University, SUMEX project: 1984
  5. //  Requires Macdefs.h
  6.  
  7. #ifndef QuickdrawLoaded
  8.  
  9.   #ifndef MacdefsLoaded
  10.     #include "macdefs.h"
  11.     #endif
  12.   
  13.   #define QuickdrawLoaded
  14.  
  15. // Really belongs in font.h
  16.  
  17.   #define Style short
  18.   
  19. // the 16 transfer modes
  20.   
  21.   #define    srcCopy      0 
  22.   #define    srcOr        1
  23.   #define    srcXor       2
  24.   #define    srcBic       3
  25.   #define    notSrcCopy   4
  26.   #define    notSrcOr     5
  27.   #define    notSrcXor    6
  28.   #define    notSrcBic    7
  29.   #define    patCopy      8
  30.   #define    patOr        9
  31.   #define    patXor       10
  32.   #define    patBic       11
  33.   #define    notPatCopy   12
  34.   #define    notPatOr     13
  35.   #define    notPatXor    14
  36.   #define    notPatBic    15
  37.   
  38. // QuickDraw color separation constants
  39.   
  40.   // normal screen mapping  
  41.     
  42.     #define    normalBit    0
  43.   
  44.   // inverse screen mapping 
  45.     
  46.     #define    inverseBit   1
  47.   
  48.   // RGB additive mapping
  49.     
  50.     #define    redBit       4
  51.     #define    greenBit     3
  52.     #define    blueBit      2
  53.   
  54.   // CMYBk subtractive mapping
  55.      
  56.     #define    cyanBit      8
  57.     #define    magentaBit   7
  58.     #define    yellowBit    6
  59.     #define    blackBit     5
  60.     
  61.   // colors expressed in these mappings
  62.     
  63.     #define    blackColor   33
  64.     #define    whiteColor   30
  65.     #define    redColor     205
  66.     #define    greenColor   341
  67.     #define    blueColor    409
  68.     #define    cyanColor    273
  69.     #define    magentaColor 137
  70.     #define    yellowColor  69
  71.     
  72.   // standard picture comments
  73.     
  74.     #define    picLParen    0
  75.     #define    picRParen    1
  76.     
  77.   // And drawing modes
  78.     
  79.     #define    frameMode    0
  80.     #define    paintMode    1
  81.     #define    eraseMode    2
  82.     #define    invertMode    3
  83.     #define    fillMode    4
  84.     
  85.   // add constants for cursors in system file 
  86.   
  87.     #define    iBeamCursor    1
  88.     #define    crossCursor    2
  89.     #define    plusCursor    3
  90.     #define    watchCursor    4
  91.    
  92. // General Types
  93.   
  94.   struct __P
  95.     {
  96.     char    s[8];
  97.     };
  98.   
  99.   #define Pattern struct __P
  100.   typedef    Pattern * PatPtr;
  101.   typedef    PatPtr * PatHandle;
  102.   
  103.   typedef struct
  104.     {
  105.     short    s[16];
  106.     } Bits16;
  107.   
  108.   #define GrafVerb short
  109.   
  110. // Screen and graph Structures
  111.   
  112.   struct __B
  113.     {
  114.     Ptr    baseAddr;
  115.     short    rowBytes;
  116.     Rect    bounds;
  117.     };
  118.   
  119.   #define BitMap struct __B
  120.   
  121.   struct __C
  122.     {
  123.     Bits16    data;
  124.     Bits16    mask;
  125.     Point    hotSpot;
  126.     };
  127.   
  128.   #define Cursor struct __C
  129.   
  130.   typedef    Cursor * CursPtr;
  131.   typedef    CursPtr * CursHandle;
  132.   
  133.   struct __PS
  134.     {
  135.     Point    pnLoc;
  136.     Point    pnSize;
  137.     short    pnMode;
  138.     Pattern    pnPat;
  139.     };
  140.   
  141.   #define PenState struct __PS
  142.   
  143.   struct __PY
  144.     {
  145.     short    polySize;
  146.     Rect    polyBBox;
  147.     Point    polyPoints[1];
  148.     };
  149.   
  150.   #define Polygon struct __PY
  151.   
  152.   typedef    Polygon * PolyPtr;
  153.   typedef    PolyPtr * PolyHandle;
  154.   
  155.   struct __RG
  156.     {
  157.     short    rgnSize;    // = 10 for rectangular
  158.     Rect    rgnBBox;
  159.     // plus more data if not rectangular
  160.     };
  161.    
  162.   #define Region struct __RG
  163.   
  164.   typedef    Region * RgnPtr;
  165.   typedef    RgnPtr * RgnHandle;
  166.   
  167.   struct __PI
  168.     {
  169.     short    picSize;
  170.     Rect    picFrame;
  171.     // plus byte codes for picture content
  172.     };
  173.   
  174.   #define Picture struct __PI
  175.   
  176.   typedef Picture * PicPtr;
  177.   typedef PicPtr * PicHandle;
  178.   
  179.   struct __Q
  180.     {
  181.     int    (*textProc)();
  182.     int    (*lineProc)();
  183.     int    (*rectProc)();
  184.     int    (*rRectProc)();
  185.     int    (*ovalProc)();
  186.     int    (*arcProc)();
  187.     int    (*polyProc)();
  188.     int    (*rgnProc)();
  189.     int    (*bitsProc)();
  190.     int    (*commentProc)();
  191.     int    (*txMeasProc)();
  192.     int    (*getPicProc)();
  193.     int    (*putPicProc)();
  194.     };
  195.   
  196.   #define QDProcs struct __Q
  197.   
  198.   typedef QDProcs * QDProcsPtr;
  199.   
  200.   struct __GP
  201.     {
  202.     short    device;
  203.     BitMap    portBits;
  204.     Rect    portRect;
  205.     RgnHandle visRgn;
  206.     RgnHandle clipRgn;
  207.     Pattern    bkPat;
  208.     Pattern    fillPat;
  209.     Point    pnLoc;
  210.     Point    pnSize;
  211.     short    pnMode;
  212.     Pattern    pnPat;
  213.     short    pnVis;
  214.     short    txFont;
  215.     Style    txFace;
  216.     short    txMode;
  217.     short    txSize;
  218.     long    spExtra;
  219.     long    fgColor;
  220.     long    bkColor;
  221.     short    colrBit;
  222.     short    patStretch;
  223.     Handle    picSave;
  224.     Handle    rgnSave;
  225.     Handle    polySave;
  226.     QDProcsPtr grafProcs;
  227.     };
  228.   
  229.   #define GrafPort struct __GP
  230.   
  231.   typedef GrafPort * GrafPtr;
  232.   
  233. struct __FO // Really should be in font.h
  234.   {
  235.   short    errNum;
  236.   Handle    fontHandle;
  237.   char    bold;
  238.   char    italic;
  239.   char    ulOffset;
  240.   char    ulShadow;
  241.   char    ulThick;
  242.   char    shadow;
  243.   char    extra;
  244.   char    ascent;
  245.   char    descent;
  246.   char    widMax;
  247.   char    leading;
  248.   char    unused;
  249.   Point    numer;
  250.   Point    denom;
  251.   };
  252.  
  253. #define FMOutRec struct __FO
  254.  
  255. typedef FMOutRec *FMOutPtr;
  256.  
  257. struct QDVar
  258.   {
  259.   FMOutRec fontData;    // font manager output record
  260.   FMOutPtr fontPtr;    // last font used; used by DrawText
  261.   long    fontAdj;    // fixed point to adjust for font subst
  262.   Point    patAlign;    // to align pattern during DrawPicture
  263.   short    polyMax;    // max bytes allocated so far to thePoly
  264.   PolyHandle thePoly;    // the current polygon being defined
  265.   short    playIndex;    // used by StdGetPic
  266.   PicHandle playPic;
  267.   short    rgnMax;        // max bytes allocated so far to rgnBuf
  268.   short    rgnIndex;    // current bytes used in rgnBuf
  269.   Handle    rgnBuf;        // buffer for OpenRgn
  270.   Region    wideData;    // a dummy rectangular region, readonly
  271.   RgnPtr    wideMaster;
  272.   RgnHandle wideOpen;
  273.   long    randSeed;    // random number generator seed
  274.   BitMap    screenBits;    // mac screen
  275.   Cursor    arrow;        // pointing arrow cursor
  276.   Pattern    dkGray;        // standard grey patterns
  277.   Pattern    ltGray;
  278.   Pattern    gray;
  279.   Pattern    black;
  280.   Pattern    white;
  281.   GrafPtr    QDthePort;    // current pointer to grafPort
  282.   };
  283.  
  284.   extern struct QDVar *QD;
  285.   #define    thePort    (QD->QDthePort)
  286.   
  287. // Functions returning other than integer
  288.   
  289.   #define GetCursor (CursHandle)GetCursor
  290.   #define GetIcon (Handle)GetIcon
  291.   #define GetPattern (PatHandle)GetPattern
  292.   #define GetPicture (PicHandle)GetPicture
  293.   #define NewRgn (RgnHandle)NewRgn
  294.   #define OpenPicture (PicHandle)OpenPicture
  295.   #define OpenPoly (PolyHandle)OpenPoly
  296.   
  297.   #endif
  298.   
  299.   
  300.